﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication5
{
	class Program
	{
		static void Main(string[] args)
		{
			//string program = "+++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>@!<+++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++<---------<++++++++++<---------<+++++++++++++++++++++++++++++++++++++<@";
			string program = "++++++++++++++++++++++++++++++++++++++++++++%>+++++++++++++++++++++%>+++++++++++++%>-------%>++++++++++++++%>--------------------%>++++++%>--@";
            char[] memory = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };

			int pointer = 0;
			foreach (char ch in program)
			{
				switch (ch)
				{
					case '!':
						memory[pointer] = ' ';
						break;
					case '>':
						if (pointer < memory.Length-1)
						{
							pointer++;
						}
						break;
					case '<':
						if (pointer > 0)
						{
							pointer--;
						}
						break;
					case '+':
						memory[pointer]++;
						break;
					case '-':
						memory[pointer]--;
						break;
					case '%':
						if (pointer + 1 < memory.Length)
						{
							memory[pointer + 1] = memory[pointer];
						}
						break;
					case '@':
						Console.Write(memory);
						break;
				}

			}
			Console.ReadLine();
		}
	}
}